package com.example.gsnd21study.service.impl;

import com.example.gsnd21study.entity.DRO.UserAndRole;
import com.example.gsnd21study.entity.User;
import com.example.gsnd21study.mapper.UserMapper;
import com.example.gsnd21study.service.UserService;
import lombok.RequiredArgsConstructor;
import org.springframework.stereotype.Service;

import java.util.Collections;
import java.util.List;


@Service
@RequiredArgsConstructor
public class UserServiceImpl implements UserService {

    private final UserMapper userMapper;

    @Override
    public UserAndRole find(Long userId) {
        return userMapper.find(userId);
    }

    @Override
    public List<User> limitFind(Integer pageNo, Integer pageSize) {
        int index = (pageNo - 1) * pageSize;
        return userMapper.limitFind(index, pageSize);
    }

}
